#ifndef RRECENTFILEMODEL_H
#define RRECENTFILEMODEL_H

#include <QAbstractListModel>
#include "rengine.h"

const QString CRoleFileId = "fileId";
const QString CRoleFileName = "fileName";
const QString CRoleLineCount = "lineCount";
const QString CRoleLastModifyTime = "lastModifyTime";
const QString CRoleLastReadTime = "lastReadTime";
const QString CRoleLastReadLine = "lastReadLine";
const QString CRoleLastReadCharIndex = "lastReadCharIndex";

enum RecentFileRole {
    KFileRoleID = 0,
    KFileRoleFileName,
    KFileRoleLineCount,
    KFileRoleLastModifyTime,
    KFileRoleLastReadTime,
    KFileRoleLastReadLine,
    KFileRoleLastReadCharIndex
};

class RRecentFileModel : public QAbstractListModel
{
    Q_OBJECT
public:
    explicit RRecentFileModel(REngine *engine);

public:

    int rowCount(const QModelIndex & parent = QModelIndex()) const;
    QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
    QVariant data(int row) const;
    Q_INVOKABLE void reload();
    Q_INVOKABLE int count() const;
signals:

public slots:

private:
    REngine* m_engine;
    QList<RFileInfo> m_file_info_list;
};

#endif // RRECENTFILEMODEL_H
